<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>表单修饰符</title>
    <script src="lib/vue.js"></script>
</head>

<body>
    <div id="box">
        //如果不需要每次输入都执行，可以加上.lazy，在满足条件(失去焦点)触发一次
        <input type="text" v-model.lazy="mytext">
        {{mytext}}

        <hr>
        <input type="text" v-model.number="mynumber">
        {{mynumber}}

        <hr>
        type="number"方法更好
        <input type="number" v-model.number="mynumber">
        {{mynumber}}

        <hr>
        <input type="text" v-model.trim="username">
        |{{username}}|

    </div>

    <script>
        new Vue({
            el: "#box",
            data: {
                mytext: "",
                mynumber: 0,
                username: ""
            }
        })
    </script>

</body>

</html>